package com.gitee.xmhzzz.component.tcp.server.dto;

import io.netty.channel.Channel;
import io.netty.util.AttributeKey;

/**
 * Channel Attr
 *
 * @author Nx Cat
 */
public class ChannelAttr {

    public static String getDeviceId(Channel channel) {
        return channel.attr(getMachineCodeKey()).get();
    }

    public static void setDeviceId(Channel channel, String deviceId) {
        channel.attr(getMachineCodeKey()).set(deviceId);
    }
    private static AttributeKey<String> getMachineCodeKey() {
        return AttributeKey.valueOf("DEVICE_CODE");
    }



}
